package stc.skymobi.netty.initializer;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInitializer;
import stc.skymobi.netty.handler.codec.memcached.MemcachedNativeCodec;

//import io.netty.handler.traffic.GlobalTrafficShapingHandler;

public class MemcachedClientInitializer extends ChannelInitializer {
//    private GlobalTrafficShapingHandler globalTrafficShapingHandler;
    private ChannelHandler memcachedResponseHandler;

    @Override
    public void initChannel(Channel ch) throws Exception {
        ch.pipeline().addLast("codec", new MemcachedNativeCodec())
                //.addLast("encoder", nettyEncoder);
//                .addLast("GLOBAL_TRAFFIC_SHAPING", globalTrafficShapingHandler)
                        //pipeline.addLast("decoder", nettyDecoder);
                .addLast("handler", memcachedResponseHandler);
    }

 /*   public void setGlobalTrafficShapingHandler(GlobalTrafficShapingHandler globalTrafficShapingHandler) {
        this.globalTrafficShapingHandler = globalTrafficShapingHandler;
    }*/

    public void setMemcachedResponseHandler(ChannelHandler memcachedResponseHandler) {
        this.memcachedResponseHandler = memcachedResponseHandler;
    }
}
